package com.plian.system.listener;

import com.plian.system.service.fr.report.IReportColumnValueService;
import com.plian.system.vo.pm.annualdonationrecordmain.AnnualDonationRecordMainVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: gangan
 * @create: 2020-09-22 10:50
 */
@Component
@AllArgsConstructor
public class AnnualDonationListener implements ApplicationListener<AnnualDonationEvent> {

    private static final Logger log = LoggerFactory.getLogger(AnnualDonationListener.class);

    private IReportColumnValueService reportColumnValueService;

    @Async("ttlExecutor")
    @Override
    public void onApplicationEvent(AnnualDonationEvent event) {
        AnnualDonationRecordMainVO recordMainVO = (AnnualDonationRecordMainVO)event.getSource();
        reportColumnValueService.initReportValue(recordMainVO.getReportId(), recordMainVO.getReportCompanyName(),
                recordMainVO.getYear(), recordMainVO.getAnnualDonationRecordVOS());
    }
}
